import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import UserView from'../views/UserView.vue'
import ManageView from '../views/ManageView.vue'
import TravelView from '../views/TravelView.vue'
import PassengerView from '../views/PassengerView.vue'
import LonginView from '../views/LonginView.vue'
import CarView from '../views/CarView.vue'
import ResponseView from '../views/ResponseView.vue'
import TravelViewSon from '../views/TravelViewSon.vue'
import View404 from '../views/404.vue'
import RegisterView from '../views/RegisterView.vue'
import PassengerViewSon from '../views/PassengerViewSon.vue'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'manage',
      component: ManageView,
      children: [
        {
          path: '/',
          name: 'home',
          component: HomeView
        },
        {
          path: 'PassengerViewSon',
          name: 'PassengerViewSon',
          component: PassengerViewSon
        },
           {
          path: 'TravelViewSon',
          name: 'TravelViewSon',
          component: TravelViewSon
        },
        {
          path: 'user',
          name: 'user',
          component: UserView
        },
        {
          path: 'passenger',
          name: 'passenger',
          component: PassengerView
        },
        {
          path: 'Travel',
          name: 'Travel',
          component: TravelView
        },
        {
          path: 'car',
          name: 'car',
          component: CarView
        },
        {
          path: 'response',
          name: 'response',
          component: ResponseView
        },
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: LonginView,
      meta: {noAauth: true},
    },
    {
      path:'/register',
      name: 'register',
      component: RegisterView
    },
    {
      path:'/404',
      name: '404',
      component: View404
    },{
      path: '/:pathMatch(.*)',
      redirect: '/404'
  }
  ]
})

export default router
